home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / editor / frexxed / fpl / backup.fpl < prev    next >
Text File  |  1995-07-18  |  1KB  |  35 lines

  1. /******************************
  2.  * Read Backup.FPL.README!    *
  3.  * Written by Daniel Stenberg *
  4.  ******************************/
  5. export int Save_hook(string filename, string packmode)
  6. {
  7.   if(ReadInfo("backup")) {
  8.     string command;
  9.     string dest;
  10.     int ret;
  11.     if(!strlen(filename)) {
  12.       filename = ReadInfo("full_file_name");
  13.     }
  14.     dest = joinstr("\"", filename, ReadInfo("backup_suffix"), "\"");
  15.  
  16.     /* check for the file */
  17.     if(Check(joinstr(filename, ReadInfo("backup_suffix")))) {
  18.       ret=Request(joinstr("Backup file ", dest, " already exists!\n"
  19.                           "Do you want to replace it?"));
  20.     }
  21.     if(ret) {
  22.       Status(0, "Backuping...");
  23.       System(joinstr("copy >NIL: CLONE \"", filename, "\" ", dest));
  24.     }
  25.     SetInfo(-1, "_backup", 1); /* backuped or selected not to become so! */
  26.   }
  27. }
  28.  
  29. ConstructInfo("_backup", "", "", "HBL", "", 0, 1);
  30. ConstructInfo("backup", "", "", "WBL(io)", "", 0, 1, -1); /* default is enabled */
  31. ConstructInfo("backup_suffix", "", "", "WSG(io)", "", 0, 0, ".bak"); /* default is enabled */
  32.  
  33.  /* Make Save() call Save_hook() if '_backup' isn't set! */
  34. Hook("Save", "Save_hook", "!_backup");
  35.